<ui:composition xmlns="http://www.w3.org/1999/xhtml"
   xmlns:ui="http://java.sun.com/jsf/facelets"
   template="../WEB-INF/shared/masterlayout.xhtml"
   xmlns:c="http://java.sun.com/jstl/core"
   xmlns:h="http://java.sun.com/jsf/html"
   xmlns:f="http://java.sun.com/jsf/core">
  <ui:define name="leftCol">
    <ui:include src="components/leftCol.xhtml"/>
  </ui:define>
  <ui:define name="rightCol">
      <h:form>
      <h1>Administrera flygningar</h1>
      <table class="manageTable">
        <thead>
            <tr>
                <td class="dateTime">Datum och tid</td>
                <td class="fromAirport">Fran Flygplats</td>
                <td class="toAirport">Till Flygplats</td>
                <td class="price">Pris</td>
                <td class="edit">Radera</td>
            </tr>
        </thead>
        <tbody>
            #{ManageFlightsBean.loadFlights()}
        <ui:repeat var="flight" value="#{ManageFlightsBean.flights}">
            <tr>
                <td class="dateTime"><h:outputText value="#{flight.startdate}"/>,
                                     <h:outputText value="#{flight.starttime}"/> till
                                     <h:outputText value="#{flight.enddate}"/>,
                                     <h:outputText value="#{flight.endtime}"/>
                                     </td>
                <td class="fromAirport"><h:outputText value="#{flight.flightPK.fromairport}"/></td>
                <td class="toAirport"><h:outputText value="#{flight.toairport}"/></td>
                <td class="price"><h:outputText value="#{flight.price}"/></td>
                <td><h:commandLink value="Radera" action="#{ManageFlightsBean.deleteFlight}">
                    <f:setPropertyActionListener target="#{ManageFlightsBean.selectedFlight}" value="#{flight}" />
                    </h:commandLink>
                </td>
            </tr>
            </ui:repeat>
        </tbody>
      </table>
      </h:form>
  </ui:define>
</ui:composition>